
package model;

import java.util.ArrayList;

public class Circuit {
	
	private String name;
	private float longitude;
	private ArrayList<Lap> laps;
	private Statistics statistics;
	
	public Circuit(String name) {
		super();
		this.name = name;
		this.laps = new ArrayList<Lap>();
		this.statistics = new Statistics();
	}
	
	public Circuit() {
		super();
		this.laps = new ArrayList<Lap>();
		this.statistics = new Statistics();
	}
	
	/**
	 * Calcula el numero de voltes actives
	 * @return el numero de voltes actives.
	 */
	public int numberOfActiveLaps() {
		int nLaps = 0;
		for(Lap lap : laps) {
			if (lap.isMostrar()) {
				nLaps++;
			}
		}
		
		return nLaps;
	}

	/**
	 * 
	 * @return name
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * 
	 * @param name
	 */
	public void setName(String name) {
		this.name = name;
	}
	
	/**
	 * 
	 * @return longitude
	 */
	public float getLongitude() {
		return longitude;
	}
	
	/**
	 * 
	 * @param longitude
	 */
	public void setLongitude(float longitude) {
		this.longitude = longitude;
	}
	
	/**
	 * 
	 * @return laps
	 */
	public ArrayList<Lap> getLaps() {
		return laps;
	}
	
	/**
	 * 
	 * @param laps
	 */
	public void setLaps(ArrayList<Lap> laps) {
		this.laps = laps;
	}

	/**
	 * 
	 * @return
	 */
	public Statistics getStatistics() {
		return statistics;
	}
	
	
	
}
